<?php /*a:2:{s:58:"E:\source\EasyPeak\application\admin\view\field\field.html";i:1577971433;s:75:"E:\source\EasyPeak\application\admin\view\..\..\common\view\admin_base.html";i:1572404708;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>编辑后台</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href=" /static/fontawesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/admin/admin.css" media="all">
    <script src="/static/js/jquery.min.js"></script>
</head>
<body>
<script src="/static/layui/layui.js"></script>
<script>
    layui.use(['form'],function(){
        var form = layui.form;
        form.on('submit(reset)',function(){
            location.reload();
        })
    })
</script>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="layui-form">
                        <div class="layui-form-item layui-hide">
                            <label class="layui-form-label">guid</label>
                            <div class="layui-input-inline" style="width:260px;">
                                <input type="text" name="form[guid]" value="<?php echo htmlentities((isset($model['guid']) && ($model['guid'] !== '')?$model['guid']:'')); ?>" autocomplete="off" placeholder="" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">字段名</label>
                            <div class="layui-input-inline" style="width:160px;">
                                <input type="text" name="form[name]" value="<?php echo htmlentities((isset($model['name']) && ($model['name'] !== '')?$model['name']:'')); ?>" autocomplete="off" placeholder="" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">在数据库中的名称</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">名称</label>
                            <div class="layui-input-inline" style="width:120px;">
                                <input type="text" name="form[title]" value="<?php echo htmlentities((isset($model['title']) && ($model['title'] !== '')?$model['title']:'')); ?>" autocomplete="off" placeholder="" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">在表单中显示的名称</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">提示</label>
                            <div class="layui-input-inline" style="width:200px;">
                                <input type="text" name="form[remark]" value="<?php echo htmlentities((isset($model['remark']) && ($model['remark'] !== '')?$model['remark']:'')); ?>" autocomplete="off" placeholder="" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">字段提示</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">验证规则</label>
                            <div class="layui-input-inline" style="width:160px;">
                                <select id="pattern_select" lay-filter="pattern">
                                    <?php if(is_array($pattern) || $pattern instanceof \think\Collection || $pattern instanceof \think\Paginator): $i = 0; $__LIST__ = $pattern;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                    <option value="<?php echo htmlentities($v['rule']); ?>" <?php if($v['rule']==$model['pattern']): ?>selected<?php endif; ?>><?php echo htmlentities($key); ?></option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                            <div class="layui-input-inline" style="width:260px;">
                                <input type="text" id="pattern" name="form[pattern]" value="<?php echo htmlentities((isset($model['pattern']) && ($model['pattern'] !== '')?$model['pattern']:'')); ?>" autocomplete="off" placeholder="" class="layui-input">
                            </div>
                            <label class="layui-form-label">失败提示</label>
                            <div class="layui-input-inline" style="width:260px;">
                                <input type="text" id="errortip" name="form[errortip]" value="<?php echo htmlentities((isset($model['errortip']) && ($model['errortip'] !== '')?$model['errortip']:'')); ?>" autocomplete="off" placeholder="" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">数据库语句</label>
                            <div class="layui-input-inline" style="width:180px;">
                                <select id="select_sql" lay-filter="sql">
                                    <?php if(is_array($sql) || $sql instanceof \think\Collection || $sql instanceof \think\Paginator): $i = 0; $__LIST__ = $sql;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                    <option value="<?php echo htmlentities($v); ?>" <?php if($v==$model['sql']): ?>selected<?php endif; ?> ><?php echo htmlentities($key); ?></option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                            <div class="layui-input-inline" style="width:360px;">
                                <input type="text" id="sql" name="form[sql]" value="<?php echo htmlentities((isset($model['sql']) && ($model['sql'] !== '')?$model['sql']:'')); ?>" autocomplete="off" placeholder="" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">如果为空，则不调整数据库表结构</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">字段类型</label>
                            <div class="layui-input-block" style="width:160px;">
                                <select name="form[type]" id="type" lay-filter="type">
                                    <?php if(is_array($type) || $type instanceof \think\Collection || $type instanceof \think\Paginator): $i = 0; $__LIST__ = $type;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                    <option value="<?php echo htmlentities($key); ?>" ><?php echo htmlentities($v); ?></option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                        <div id="values"></div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">主表</label>
                            <div class="layui-input-block">
                                <input type="radio" name="form[ismain]" value="1" title="是" <?php echo !empty($model['ismain']) ? "checked" : ""; ?> >
                                <input type="radio" name="form[ismain]" value="0" title="否" <?php echo !empty($model['ismain']) ? "" : "checked"; ?>>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">必填</label>
                            <div class="layui-input-block">
                                <input type="radio" name="form[isrequire]" value="1" title="是" <?php echo !empty($model['isrequire']) ? "checked" : ""; ?> >
                                <input type="radio" name="form[isrequire]" value="0" title="否" <?php echo !empty($model['isrequire']) ? "" : "checked"; ?>>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">表单显示</label>
                            <div class="layui-input-block">
                                <input type="radio" name="form[show]" value="1" title="是" <?php echo !empty($model['show']) ? "checked" : ""; ?> >
                                <input type="radio" name="form[show]" value="0" title="否" <?php echo !empty($model['show']) ? "" : "checked"; ?>>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">投稿显示</label>
                            <div class="layui-input-block">
                                <input type="radio" name="form[ispostshow]" value="1" title="是" <?php echo !empty($model['ispostshow']) ? "checked" : ""; ?> >
                                <input type="radio" name="form[ispostshow]" value="0" title="否" <?php echo !empty($model['ispostshow']) ? "" : "checked"; ?>>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">列表显示</label>
                            <div class="layui-input-block">
                                <input type="radio" name="form[showintable]" value="1" title="是" <?php echo !empty($model['showintable']) ? "checked" : ""; ?> >
                                <input type="radio" name="form[showintable]" value="0" title="否" <?php echo !empty($model['showintable']) ? "" : "checked"; ?>>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">排序</label>
                            <div class="layui-input-inline" style="width:260px;">
                                <input type="text" name="form[sort]" value="<?php echo htmlentities((isset($model['sort']) && ($model['sort'] !== '')?$model['sort']:'50')); ?>" autocomplete="off" placeholder="" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">是否启用</label>
                            <div class="layui-input-block">
                                <input type="radio" name="form[status]" value="1" title="是" <?php echo !empty($model['status']) ? "checked" : ""; ?> >
                                <input type="radio" name="form[status]" value="0" title="否" <?php echo !empty($model['status']) ? "" : "checked"; ?>>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="commit">提交</button>
                                <button class="layui-btn layui-btn-primary" lay-submit lay-filter="reset">重置</button>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="textbox_config">
    <div class="layui-form-item">
        <label class="layui-form-label">默认值</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][defaultval]" autocomplete="off" placeholder="默认值" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['defaultval']) && ($model['configs']['defaultval'] !== '')?$model['configs']['defaultval']:'')); ?>">
        </div>
        <label class="layui-form-label">显示宽度</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][width]" autocomplete="off" placeholder="显示宽度" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['width']) && ($model['configs']['width'] !== '')?$model['configs']['width']:'')); ?>" />
        </div>
        <div class="layui-form-mid layui-word-aux">px</div>
    </div>
</script>
<script type="text/html" id="date_config">
    <div class="layui-form-item">
        <label class="layui-form-label">显示格式</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][format]" autocomplete="off" placeholder="显示宽度" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['format']) && ($model['configs']['format'] !== '')?$model['configs']['format']:'yyyy-MM-dd HH:mm:ss')); ?>">
        </div>
    </div>
</script>
<script type="text/html" id="textarea_config">
    <div class="layui-form-item">
        <label class="layui-form-label">默认值</label>
        <div class="layui-input-block" style="min-width:400px;max-width:600px;height:100px;">
            <textarea type="text" name="form[configs][defaultval]" autocomplete="off" placeholder="默认值" class="layui-textarea"><?php echo htmlentities((isset($model['configs']['defaultval']) && ($model['configs']['defaultval'] !== '')?$model['configs']['defaultval']:'')); ?></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">显示宽度</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][width]" autocomplete="off" placeholder="显示宽度" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['width']) && ($model['configs']['width'] !== '')?$model['configs']['width']:'')); ?>" />
        </div>
        <div class="layui-form-mid layui-word-aux">px</div>
    </div>
</script>
<script type="text/html" id="checkbox_config">
    <div class="layui-form-item">
        <label class="layui-form-label">默认值</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][defaultval]" autocomplete="off" placeholder="默认值" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['defaultval']) && ($model['configs']['defaultval'] !== '')?$model['configs']['defaultval']:'')); ?>" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">可选项</label>
        <div class="layui-input-block" style="min-width:400px;max-width:600px;height:100px;">
            <textarea type="text" name="form[configs][values]" autocomplete="off" placeholder="键值对，格式为 id|val,id|val" class="layui-textarea"><?php echo htmlentities((isset($model['configs']['values']) && ($model['configs']['values'] !== '')?$model['configs']['values']:'')); ?></textarea>
        </div>
    </div>
</script>
<script type="text/html" id="radio_config">
    <div class="layui-form-item">
        <label class="layui-form-label">默认值</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][defaultval]" autocomplete="off" placeholder="默认值" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['defaultval']) && ($model['configs']['defaultval'] !== '')?$model['configs']['defaultval']:'')); ?>" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">可选项</label>
        <div class="layui-input-block" style="min-width:400px;max-width:600px;height:100px;">
            <textarea type="text" name="form[configs][values]" autocomplete="off" placeholder="键值对，格式为 id|val,id|val" class="layui-textarea"><?php echo htmlentities((isset($model['configs']['values']) && ($model['configs']['values'] !== '')?$model['configs']['values']:'')); ?></textarea>
        </div>
    </div>
</script>
<script type="text/html" id="select_config">
    <div class="layui-form-item">
        <label class="layui-form-label">默认值</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][defaultval]" autocomplete="off" placeholder="默认值" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['defaultval']) && ($model['configs']['defaultval'] !== '')?$model['configs']['defaultval']:'')); ?>" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">可选项</label>
        <div class="layui-input-block" style="min-width:400px;max-width:600px;height:100px;">
            <textarea type="text" name="form[configs][values]" autocomplete="off" placeholder="键值对，格式为 id|val,id|val" class="layui-textarea"><?php echo htmlentities((isset($model['configs']['values']) && ($model['configs']['values'] !== '')?$model['configs']['values']:'')); ?></textarea>
        </div>
    </div>
</script>
<script type="text/html" id="file_config">
    <div class="layui-form-item">
        <label class="layui-form-label">最大限制</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][maxsize]" autocomplete="off" placeholder="默认值" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['maxsize']) && ($model['configs']['maxsize'] !== '')?$model['configs']['maxsize']:'2048')); ?>" />
        </div>
        <div class="layui-form-mid layui-word-aux">KB</div>
    </div>
</script>
<script type="text/html" id="combotree_config">
    <div class="layui-form-item">
        <label class="layui-form-label">默认值</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][defaultval]" autocomplete="off" placeholder="默认值" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['defaultval']) && ($model['configs']['defaultval'] !== '')?$model['configs']['defaultval']:'')); ?>" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">数据源</label>
        <div class="layui-input-inline" style="width:400px;">
            <input type="text" name="form[configs][url]" autocomplete="off" placeholder="数据来源网址，数据为list形式即可，前台通过js转换为树结构" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['url']) && ($model['configs']['url'] !== '')?$model['configs']['url']:'')); ?>" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">节点名</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][idkey]" autocomplete="off" placeholder="idkey" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['idkey']) && ($model['configs']['idkey'] !== '')?$model['configs']['idkey']:'')); ?>" />
        </div>
        <label class="layui-form-label">根节点值</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][root]" autocomplete="off" placeholder="rootvalue" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['root']) && ($model['configs']['root'] !== '')?$model['configs']['root']:'')); ?>" />
        </div>
        <label class="layui-form-label">父节点名</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][pidkey]" autocomplete="off" placeholder="父节点名称" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['pidkey']) && ($model['configs']['pidkey'] !== '')?$model['configs']['pidkey']:'')); ?>" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">文字名</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][namekey]" autocomplete="off" placeholder="namekey" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['namekey']) && ($model['configs']['namekey'] !== '')?$model['configs']['namekey']:'')); ?>" />
        </div>
        <label class="layui-form-label">宽度</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][width]" autocomplete="off" placeholder="显示宽度" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['width']) && ($model['configs']['width'] !== '')?$model['configs']['width']:'')); ?>" />
        </div>
        <div class="layui-form-mid layui-word-aux">px</div>
    </div>
</script>
<script type="text/html" id="image_config">
    <div class="layui-form-item">
        <label class="layui-form-label">最大限制</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][maxsize]" autocomplete="off" placeholder="默认值" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['maxsize']) && ($model['configs']['maxsize'] !== '')?$model['configs']['maxsize']:'2048')); ?>" />
        </div>
        <div class="layui-form-mid layui-word-aux">KB</div>
        <label class="layui-form-label">图片类型</label>
        <div class="layui-input-inline">
            <input type="text" name="form[configs][extension]" autocomplete="off" placeholder="默认值" class="layui-input" value="<?php echo htmlentities((isset($model['configs']['extension']) && ($model['configs']['extension'] !== '')?$model['configs']['extension']:'jpg,png,gif,bmp,jpeg')); ?>" />
        </div>
    </div>
</script>
<script>
    layui.use(['form','element','laytpl'],function(){
        var form = layui.form;
        var element = layui.element;
        var laytpl = layui.laytpl;

        form.on('select(pattern)', function(data){
            $("#pattern").val(data.value);
        });
        form.on('select(sql)', function(data){
            $("#sql").val(data.value);
        });
        form.on('select(type)', function(data){
            var renderhtml = $("#"+data.value+"_config").html();
            if(renderhtml == undefined)
                renderhtml = '';
            $("#values").html(renderhtml);
        });
        $("#type").next(".layui-form-select").find("dd[lay-value='<?php echo htmlentities((isset($model['type']) && ($model['type'] !== '')?$model['type']:'')); ?>']").trigger('click');

        form.on('submit(commit)', function(obj){
            $.post({
                url:document.URL
                ,type:'post'
                ,data: obj.field
                ,success:function(res){
                    if(res.code == 1){
                        layer.msg(res.msg, {
                            offset: '15px'
                            ,icon: 1
                            ,time: 1000
                        }, function(){
                            location.href = res.url;
                        });
                    }else{
                        layer.msg(res.msg);
                    }
                }
            });
        });

    });
</script>

</body>
</html>